/*
 Navicat Premium Data Transfer

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 50711
 Source Host           : 127.0.0.1
 Source Database       : restaurant

 Target Server Type    : MySQL
 Target Server Version : 50711
 File Encoding         : utf-8

 Date: 12/21/2016 02:17:03 AM
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `t_mg_menu`
-- ----------------------------
DROP TABLE IF EXISTS `t_mg_menu`;
CREATE TABLE `t_mg_menu` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `code` varchar(40) DEFAULT NULL COMMENT '编码',
  `name` varchar(100) DEFAULT NULL COMMENT '名称',
  `price` decimal(6,2) DEFAULT NULL COMMENT '单价',
  `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `valid` varchar(2) DEFAULT '1' COMMENT '有效状态  0：无效  1：有效',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COMMENT='菜单管理表';

-- ----------------------------
--  Records of `t_mg_menu`
-- ----------------------------
BEGIN;
INSERT INTO `t_mg_menu` VALUES ('1', '3', '3', '3.00', '2016-12-18 03:58:10', '0'), ('2', '1', '2', '3.00', '2016-12-18 03:58:45', '0'), ('3', '4', '5', '6.00', '2016-12-18 03:58:54', '0'), ('4', '3', '3', '3.00', '2016-12-18 04:42:13', '0'), ('5', '4', '4', '4.00', '2016-12-18 04:42:18', '0'), ('6', '333', '444', '555.00', '2016-12-18 04:44:23', '0'), ('7', '888', '0000', '1111.00', '2016-12-18 04:44:38', '0'), ('8', '333', '44', '555.00', '2016-12-18 04:44:49', '0'), ('9', '1111', '222', '333.00', '2016-12-18 04:46:06', '0'), ('10', '111', '222', '333.00', '2016-12-18 04:46:14', '1'), ('14', '1', '2', '3.00', '2016-12-18 06:04:31', '1'), ('15', '11', '22', '33.00', '2016-12-18 06:58:28', '1'), ('16', '1', 'xxxx', '3.00', '2016-12-18 07:03:57', '0'), ('17', '1', '芒果', '2.00', '2016-12-18 07:05:06', '1'), ('18', '3', '菠萝', '5.00', '2016-12-18 21:21:40', '1'), ('19', '3', '31', '3.00', '2016-12-18 21:22:19', '0'), ('20', '1', '黄瓜', '3.00', '2016-12-18 21:23:50', '1'), ('21', '33', '茄子', '55.00', '2016-12-18 21:25:18', '1'), ('22', '123', '西红柿', '3.00', '2016-12-18 22:23:15', '1'), ('23', '123', '白菜', '59.00', '2016-12-20 22:09:05', '1'), ('24', '48', '大西瓜', '24.00', '2016-12-20 22:09:21', '1'), ('25', '11111', '番瓜', '1.50', '2016-12-20 22:34:55', '1'), ('26', '1231', '胡萝卜1', '11.11', '2016-12-21 01:13:53', '1');
COMMIT;

-- ----------------------------
--  Table structure for `t_mg_repast`
-- ----------------------------
DROP TABLE IF EXISTS `t_mg_repast`;
CREATE TABLE `t_mg_repast` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `tbid` int(11) DEFAULT NULL COMMENT '桌位主键',
  `rece` decimal(6,2) DEFAULT NULL COMMENT '应收金额',
  `actual` decimal(6,2) DEFAULT NULL COMMENT '实际金额',
  `descr` varchar(600) DEFAULT NULL COMMENT '描述',
  `state` varchar(2) DEFAULT '0' COMMENT '结账状态 0：未结账   1：已结账',
  `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `end` timestamp NULL DEFAULT NULL COMMENT '结束时间',
  PRIMARY KEY (`id`),
  KEY `tbid` (`tbid`),
  CONSTRAINT `fk_table` FOREIGN KEY (`tbid`) REFERENCES `t_mg_table` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COMMENT='就餐记录表';

-- ----------------------------
--  Records of `t_mg_repast`
-- ----------------------------
BEGIN;
INSERT INTO `t_mg_repast` VALUES ('15', '8', '90.00', '90.00', '没有说明', '1', '2016-12-20 23:19:05', '2016-12-20 23:19:41'), ('16', '3', '16.00', '16.00', '老子信了你的邪', '1', '2016-12-20 23:19:07', '2016-12-20 23:23:20'), ('17', '8', '395.00', '395.00', '', '1', '2016-12-20 23:23:21', '2016-12-21 02:07:48'), ('18', '4', '24.00', '24.00', '', '1', '2016-12-20 23:23:23', '2016-12-21 02:15:42'), ('19', '6', '0.00', '0.00', '', '1', '2016-12-21 01:14:49', '2016-12-21 01:14:54'), ('20', '6', '0.00', '0.00', '', '1', '2016-12-21 01:15:18', '2016-12-21 01:15:24'), ('21', '6', '0.00', '0.00', '', '1', '2016-12-21 01:16:47', '2016-12-21 01:16:49'), ('22', '6', '0.00', '0.00', '', '1', '2016-12-21 01:16:52', '2016-12-21 01:16:57'), ('23', '9', '2.00', '0.00', '', '1', '2016-12-21 01:27:51', '2016-12-21 02:04:05'), ('24', '8', '66.00', '66.00', '', '1', '2016-12-21 02:14:04', '2016-12-21 02:14:16'), ('25', '8', null, null, null, '0', '2016-12-21 02:15:47', null);
COMMIT;

-- ----------------------------
--  Table structure for `t_mg_table`
-- ----------------------------
DROP TABLE IF EXISTS `t_mg_table`;
CREATE TABLE `t_mg_table` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `num` int(11) DEFAULT NULL COMMENT '编号',
  `type` varchar(2) DEFAULT NULL COMMENT '类型：01：普通 02：包间',
  `descr` varchar(600) DEFAULT NULL COMMENT '描述',
  `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `valid` varchar(2) DEFAULT '1' COMMENT '是否有效 0：无效 1：有效',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COMMENT='桌位管理表';

-- ----------------------------
--  Records of `t_mg_table`
-- ----------------------------
BEGIN;
INSERT INTO `t_mg_table` VALUES ('1', '1', '01', '桌位内容23 \n保存\n保存\n保存', '2016-12-18 22:19:19', '0'), ('2', '1', '01', '2', '2016-12-18 22:21:50', '0'), ('3', '1', '01', '4', '2016-12-18 22:21:55', '0'), ('4', '2', '02', '66', '2016-12-18 22:22:00', '1'), ('5', '89', '02', '99', '2016-12-18 22:22:09', '0'), ('6', '3', '01', '2', '2016-12-18 22:22:14', '1'), ('7', '1', '01', '说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明', '2016-12-18 23:27:46', '0'), ('8', '41', '02', '333341', '2016-12-19 01:11:25', '1'), ('9', '6', '01', '111', '2016-12-21 01:14:40', '1');
COMMIT;

-- ----------------------------
--  Table structure for `t_mid_repast_menu`
-- ----------------------------
DROP TABLE IF EXISTS `t_mid_repast_menu`;
CREATE TABLE `t_mid_repast_menu` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `repastid` int(11) DEFAULT NULL,
  `menuid` int(11) DEFAULT NULL,
  `num` int(4) DEFAULT NULL COMMENT '数量',
  `state` varchar(2) DEFAULT '0' COMMENT '状态 0：未上菜  1：已上菜',
  `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `menuid` (`menuid`),
  KEY `repastid` (`repastid`),
  CONSTRAINT `fk_menu` FOREIGN KEY (`menuid`) REFERENCES `t_mg_menu` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_repast` FOREIGN KEY (`repastid`) REFERENCES `t_mg_repast` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 COMMENT='就餐和菜单中间表';

-- ----------------------------
--  Records of `t_mid_repast_menu`
-- ----------------------------
BEGIN;
INSERT INTO `t_mid_repast_menu` VALUES ('17', '15', '14', '2', '1', '2016-12-20 23:19:18'), ('18', '15', '24', '3', '1', '2016-12-20 23:19:18'), ('19', '15', '20', '3', '1', '2016-12-20 23:19:18'), ('20', '15', '22', '1', '1', '2016-12-20 23:19:18'), ('21', '16', '18', '2', '1', '2016-12-20 23:21:53'), ('22', '16', '16', '1', '1', '2016-12-20 23:22:50'), ('23', '16', '22', '1', '1', '2016-12-20 23:22:50'), ('24', '18', '24', '1', '1', '2016-12-20 23:24:45'), ('25', '17', '10', '1', '0', '2016-12-21 01:00:52'), ('26', '17', '20', '1', '1', '2016-12-21 01:00:52'), ('27', '17', '23', '1', '1', '2016-12-21 01:00:52'), ('28', '23', '17', '1', '0', '2016-12-21 01:28:04'), ('29', '24', '18', '1', '0', '2016-12-21 02:14:13'), ('30', '24', '20', '1', '0', '2016-12-21 02:14:13'), ('31', '24', '21', '1', '0', '2016-12-21 02:14:13'), ('32', '24', '22', '1', '0', '2016-12-21 02:14:13'), ('33', '25', '15', '1', '0', '2016-12-21 02:15:53'), ('34', '25', '21', '1', '0', '2016-12-21 02:15:53'), ('35', '25', '23', '1', '0', '2016-12-21 02:15:53'), ('36', '25', '22', '1', '0', '2016-12-21 02:15:53');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
